package monopoly.ui;

import monopoly.Railroad;
import monopoly.StreetProperty;
import monopoly.Tax;
import monopoly.Utility;

public class GameBoard {
	
	private GameBoardSpace[] gameBoard;
	
	public GameBoard()
	{
		initGameBoardData();
		initRailroads();
		initUtilities();
		initStreetProperties();
		initTaxes();
		initCards();	
	}
	
	public GameBoardSpace[] getSpaceArray()
	{
		return gameBoard;
	}

	private void initGameBoardData()
	{
		gameBoard = new GameBoardSpace[41];
		gameBoard[0] = new GameBoardSpace("images/board/board0.gif", "images/card/card0.gif", 620, 620, "Go");
		gameBoard[1] = new GameBoardSpace("images/board/board1.gif", "images/card/card1.gif", 560, 620, "Mediterranean Avenue");
		gameBoard[2] = new GameBoardSpace("images/board/board2.gif", "images/card/card2.gif", 500, 620, "Community Chest");
		gameBoard[3] = new GameBoardSpace("images/board/board3.gif", "images/card/card3.gif", 440, 620, "Baltic Avenue");
		gameBoard[4] = new GameBoardSpace("images/board/board4.gif", "images/card/card4.gif", 380, 620, "Income Tax");
		gameBoard[5] = new GameBoardSpace("images/board/board5.gif", "images/card/card5.gif", 320, 620, "Reading Railroad");
		gameBoard[6] = new GameBoardSpace("images/board/board6.gif", "images/card/card6.gif", 260, 620, "Oriental Avenue");
		gameBoard[7] = new GameBoardSpace("images/board/board7.gif", "images/card/card7.gif", 200, 620, "Chance");
		gameBoard[8] = new GameBoardSpace("images/board/board8.gif", "images/card/card8.gif", 140, 620, "Vermont Avenue");
		gameBoard[9] = new GameBoardSpace("images/board/board9.gif", "images/card/card9.gif", 80, 620, "Connecticut Avenue");
		gameBoard[10] = new GameBoardSpace("images/board/board10.gif", "images/card/card10.gif", 0, 620, "Just Visiting");
		gameBoard[11] = new GameBoardSpace("images/board/board11.gif", "images/card/card11.gif", 0, 560, "St. Charles Place");
		gameBoard[12] = new GameBoardSpace("images/board/board12.gif", "images/card/card12.gif", 0, 500, "Electric Company");
		gameBoard[13] = new GameBoardSpace("images/board/board13.gif", "images/card/card13.gif", 0, 440, "States Avenue");
		gameBoard[14] = new GameBoardSpace("images/board/board14.gif", "images/card/card14.gif", 0, 380, "Virginia Avenue");
		gameBoard[15] = new GameBoardSpace("images/board/board15.gif", "images/card/card15.gif", 0, 320, "Pennsylvania Railroad");
		gameBoard[16] = new GameBoardSpace("images/board/board16.gif", "images/card/card16.gif", 0, 260, "St. James Place");
		gameBoard[17] = new GameBoardSpace("images/board/board17.gif", "images/card/card17.gif", 0, 200, "Community Chest");
		gameBoard[18] = new GameBoardSpace("images/board/board18.gif", "images/card/card18.gif", 0, 140, "Tennesee Avenue");
		gameBoard[19] = new GameBoardSpace("images/board/board19.gif", "images/card/card19.gif", 0, 80, "New York Avenue");
		gameBoard[20] = new GameBoardSpace("images/board/board20.gif", "images/card/card20.gif", 0, 0, "Free Parking");
		gameBoard[21] = new GameBoardSpace("images/board/board21.gif", "images/card/card21.gif", 80, 0, "Kentucky Avenue");
		gameBoard[22] = new GameBoardSpace("images/board/board22.gif", "images/card/card22.gif", 140, 0, "Indiana Avenue");
		gameBoard[23] = new GameBoardSpace("images/board/board23.gif", "images/card/card23.gif", 200, 0, "Chance");
		gameBoard[24] = new GameBoardSpace("images/board/board24.gif", "images/card/card24.gif", 260, 0, "Illinois Avenue");
		gameBoard[25] = new GameBoardSpace("images/board/board25.gif", "images/card/card25.gif", 320, 0, "B & O Railroad");
		gameBoard[26] = new GameBoardSpace("images/board/board26.gif", "images/card/card26.gif", 380, 0, "Atlantic Avenue");
		gameBoard[27] = new GameBoardSpace("images/board/board27.gif", "images/card/card27.gif", 440, 0, "Ventnor Avenue");
		gameBoard[28] = new GameBoardSpace("images/board/board28.gif", "images/card/card28.gif", 500, 0, "Water Works");
		gameBoard[29] = new GameBoardSpace("images/board/board29.gif", "images/card/card29.gif", 560, 0, "Marvin Gardens");
		gameBoard[30] = new GameBoardSpace("images/board/board30.gif", "images/card/card30.gif", 620, 0, "Go To Jail");
		gameBoard[31] = new GameBoardSpace("images/board/board31.gif", "images/card/card31.gif", 620, 80, "Pacific Avenue");
		gameBoard[32] = new GameBoardSpace("images/board/board32.gif", "images/card/card32.gif", 620, 140, "North Carolina Avenue");
		gameBoard[33] = new GameBoardSpace("images/board/board33.gif", "images/card/card33.gif", 620, 200, "Community Chest");
		gameBoard[34] = new GameBoardSpace("images/board/board34.gif", "images/card/card34.gif", 620, 260, "Pennsylvania Avenue");
		gameBoard[35] = new GameBoardSpace("images/board/board35.gif", "images/card/card35.gif", 620, 320, "Short Line Railroad");
		gameBoard[36] = new GameBoardSpace("images/board/board36.gif", "images/card/card36.gif", 620, 380, "Chance");
		gameBoard[37] = new GameBoardSpace("images/board/board37.gif", "images/card/card37.gif", 620, 440, "Park Place");
		gameBoard[38] = new GameBoardSpace("images/board/board38.gif", "images/card/card38.gif", 620, 500, "Luxury Tax");
		gameBoard[39] = new GameBoardSpace("images/board/board39.gif", "images/card/card39.gif", 620, 560, "Boardwalk");
		gameBoard[40] = new GameBoardSpace("images/board/board40.gif", "images/card/card40.gif", 0, 620, "In Jail");
	}
	
	private void initRailroads()
	{
		gameBoard[5].setRailroad(new Railroad(200.0, "Reading RR"));
		gameBoard[15].setRailroad(new Railroad(200.0, "Pennsylvania RR"));
		gameBoard[25].setRailroad(new Railroad(200.0, "B&O RR"));
		gameBoard[35].setRailroad(new Railroad(200.0, "Short Line RR"));
	}
	
	private void initUtilities()
	{
		gameBoard[12].setUtility(new Utility(150.0, "Electric Company"));
		gameBoard[28].setUtility(new Utility(150.0, "Water Works"));		
	}
	
	private void initStreetProperties()
	{
		gameBoard[1].setStreetProperty(new StreetProperty(60.0, 50.0, 2.0, 10.0, 30.0, 90.0, 160.0, 250.0, 30.0, 0, 0, "images/tableIcon/purple.gif", "Mediterranean Ave"));
		gameBoard[3].setStreetProperty(new StreetProperty(60.0, 50.0, 4.0, 20.0, 60.0, 180.0, 320.0, 450.0, 30.0, 0, 1, "images/tableIcon/purple.gif","Baltic Ave"));
		gameBoard[6].setStreetProperty(new StreetProperty(100.0, 50.0, 6.0, 30.0, 90.0, 270.0, 400.0, 550.0, 50.0, 1, 0, "images/tableIcon/grey.gif", "Oriental Ave"));
		gameBoard[8].setStreetProperty(new StreetProperty(100.0, 50.0, 6.0, 30.0, 90.0, 270.0, 400.0, 550.0, 50.0, 1, 1, "images/tableIcon/grey.gif", "Vermont Ave"));
		gameBoard[9].setStreetProperty(new StreetProperty(120.0, 50.0, 8.0, 40.0, 100.0, 300.0, 450.0, 600.0, 60.0, 1, 2, "images/tableIcon/grey.gif", "Connecticut Ave"));
		gameBoard[11].setStreetProperty(new StreetProperty(140.0, 100.0, 10.0, 50.0, 150.0, 450.0, 620.0, 750.0, 70.0, 2, 0, "images/tableIcon/maroon.gif", "St. Charles Place"));
		gameBoard[13].setStreetProperty(new StreetProperty(140.0, 100.0, 10.0, 50.0, 150.0, 450.0, 620.0, 750.0, 70.0, 2, 1, "images/tableIcon/maroon.gif", "States Ave"));
		gameBoard[14].setStreetProperty(new StreetProperty(160.0, 100.0, 12.0, 60.0, 180.0, 500.0, 700.0, 900.0, 80.0, 2, 2, "images/tableIcon/maroon.gif", "Virginia Ave"));
		gameBoard[16].setStreetProperty(new StreetProperty(180.0, 100.0, 14.0, 70.0, 200.0, 550.0, 750.0, 950.0, 90.0, 3, 0, "images/tableIcon/orange.gif", "St. James Ave"));
		gameBoard[18].setStreetProperty(new StreetProperty(180.0, 100.0, 14.0, 70.0, 200.0, 550.0, 750.0, 950.0, 90.0, 3, 1, "images/tableIcon/orange.gif", "Tennessee Ave"));
		gameBoard[19].setStreetProperty(new StreetProperty(200.0, 100.0, 16.0, 80.0, 220.0, 600.0, 800.0, 1000.0, 100.0, 3, 2, "images/tableIcon/orange.gif", "New York Ave"));
		gameBoard[21].setStreetProperty(new StreetProperty(220.0, 150.0, 18.0, 90.0, 250.0, 700.0, 875.0, 1050.0, 110.0, 4, 0, "images/tableIcon/red.gif", "Kentucky Ave"));
		gameBoard[22].setStreetProperty(new StreetProperty(220.0, 150.0, 18.0, 90.0, 250.0, 700.0, 875.0, 1050.0, 110.0, 4, 1, "images/tableIcon/red.gif", "Indiana Ave"));
		gameBoard[24].setStreetProperty(new StreetProperty(240.0, 150.0, 20.0, 100.0, 300.0, 750.0, 925.0, 1100.0, 120.0, 4, 2, "images/tableIcon/red.gif", "Illinois Ave"));
		gameBoard[26].setStreetProperty(new StreetProperty(260.0, 150.0, 22.0, 110.0, 330.0, 800.0, 975.0, 1150.0, 130.0, 5, 0, "images/tableIcon/yellow.gif", "Atlantic Ave"));
		gameBoard[27].setStreetProperty(new StreetProperty(260.0, 150.0, 22.0, 110.0, 330.0, 800.0, 975.0, 1150.0, 130.0, 5, 1, "images/tableIcon/yellow.gif", "Ventnor Ave"));
		gameBoard[29].setStreetProperty(new StreetProperty(280.0, 150.0, 24.0, 120.0, 360.0, 850.0, 1025.0, 1200.0, 140.0, 5, 2, "images/tableIcon/yellow.gif", "Marvin Gardens"));
		gameBoard[31].setStreetProperty(new StreetProperty(300.0, 200.0, 26.0, 130.0, 390.0, 900.0, 1100.0, 1275.0, 150.0, 6, 0, "images/tableIcon/green.gif", "Pacific Ave"));
		gameBoard[32].setStreetProperty(new StreetProperty(300.0, 200.0, 26.0, 130.0, 390.0, 900.0, 1100.0, 1275.0, 150.0, 6, 1, "images/tableIcon/green.gif", "No Carolina Ave"));
		gameBoard[34].setStreetProperty(new StreetProperty(320.0, 200.0, 28.0, 150.0, 450.0, 1000.0, 1200.0, 1400.0, 160.0, 6, 2, "images/tableIcon/green.gif", "Pennsylvania Ave"));
		gameBoard[37].setStreetProperty(new StreetProperty(350.0, 200.0, 35.0, 175.0, 500.0, 1100.0, 1300.0, 1500.0, 175.0, 7, 0, "images/tableIcon/blue.gif", "Park Place"));
		gameBoard[39].setStreetProperty(new StreetProperty(400.0, 200.0, 50.0, 200.0, 600.0, 1400.0, 1700.0, 2000.0, 200.0, 7, 1, "images/tableIcon/blue.gif", "Boardwalk"));
	}
	
	private void initTaxes()
	{
		gameBoard[4].setTax(new Tax(2, 200.0, 0.10));
		gameBoard[38].setTax(new Tax(1, 75.0, 0.00));
	}
	
	private void initCards()
	{
		gameBoard[2].setCard("Community Chest");
		gameBoard[17].setCard("Community Chest");
		gameBoard[33].setCard("Community Chest");
		
		gameBoard[7].setCard("Chance");
		gameBoard[23].setCard("Chance");
		gameBoard[36].setCard("Chance");
	}


}
